package br.com.lucasddaniel.merchanmobile.activities;

import java.io.File;

import br.com.lucasddaniel.merchanmobile.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;

public class SplashActivity extends Activity implements Runnable {

	private Handler handler;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);
		
		File file = new File(Environment.getExternalStorageDirectory() + "/merchanmobile");
		if (!file.exists()) {
			file.mkdirs();
		}
		
		handler = new Handler();
		handler.postDelayed(this, 2000);
	}

	@Override
	protected void onPause() {
		super.onPause();
		handler.removeCallbacks(this);
	}

	public void run() {
		Intent it = new Intent(this, LoginActivity.class);
		startActivity(it);
		finish();
		overridePendingTransition(
		android.R.anim.fade_in, android.R.anim.fade_out);
	}
}